package com.feicheng.common.mqtt;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.constant.Constant;
import com.feicheng.common.util.StringGenerator;

import java.time.LocalDateTime;

public class MsgFactory {

    public static MqttCmd onlineAck(String sn) {
        MqttCmd cmd = new MqttCmd.Builder().operator("Online-Ack").build();
        JSONObject info = cmd.getInfoObject();
        info.put("result", "ok");
        info.put("facesluiceId", sn);
        return cmd;
    }

    public static MqttCmd deleteAllPerson(String sn) {
        MqttCmd cmd = new MqttCmd.Builder().operator("DeleteAllPerson").build();
        JSONObject info = cmd.getInfoObject();
        info.put("deleteall", 1);
        return cmd;
    }

    public static MqttCmd addPersons(String sn, JSONArray info) {
        MqttCmd cmd = new MqttCmd.Builder()
                .operator("AddPersons")
                .info(info)
                .build();
        cmd.put("DataBegin", "BeginFlag");
        cmd.put("DataEnd", "EndFlag");
        cmd.put("PersonNum", info.size());
        return cmd;
    }

    public static MqttCmd editPerson(String sn) {
        return new MqttCmd.Builder().operator("EditPerson").build();
    }

    public static MqttCmd unLock(String sn) {
        return new MqttCmd.Builder().operator("Unlock").build();
    }






}
